package com.lwj.liwanjia.adapter;

import android.content.Context;
import android.support.v7.widget.LinearLayoutManager;
import android.widget.ImageView;

import com.bumptech.glide.Glide;
import com.lwj.liwanjia.R;
import com.lwj.liwanjia.bean.JieSuanBean;
import com.superrecycleview.superlibrary.adapter.BaseViewHolder;
import com.superrecycleview.superlibrary.adapter.SuperBaseAdapter;
import com.superrecycleview.superlibrary.recycleview.SuperRecyclerView;

import java.util.List;

/**
 * Created by Administrator on 2017/9/12.
 */

public class GwcIndentAdapter extends SuperBaseAdapter<JieSuanBean.DataBean.ShopInfoBean> {
    private Context context;

    public GwcIndentAdapter(Context context, List<JieSuanBean.DataBean.ShopInfoBean> data) {
        super(context, data);
        this.context = context;
    }

    @Override
    protected void convert(BaseViewHolder holder, JieSuanBean.DataBean.ShopInfoBean item, int position) {
        Glide.with(context).load(item.getShopImage()).error(R.mipmap.shop_image_2).into((ImageView) holder.getView(R.id.iv_market));
        holder.setText(R.id.tv_market, item.getShopName());
        LinearLayoutManager manager = new LinearLayoutManager(context);
        manager.setOrientation(LinearLayoutManager.VERTICAL);
        SuperRecyclerView recyclerView = holder.getView(R.id.list_shangpin);
        recyclerView.setLayoutManager(manager);
        recyclerView.setRefreshEnabled(false);
        recyclerView.setLoadMoreEnabled(false);
        GwcIndentListAdapter adapter = new GwcIndentListAdapter(context, item.getGoods());
        recyclerView.setAdapter(adapter);
    }

    @Override
    protected int getItemViewLayoutId(int position, JieSuanBean.DataBean.ShopInfoBean item) {
        return R.layout.indent_item;
    }
}
